<?php
class TemplateTableSeeder extends Seeder {

    public function run()
    {
        // to use non Eloquent-functions we need to unguard
        Eloquent::unguard();

        // All existing users are deleted !!!
        DB::table('templateParams')->delete();
        DB::table('templates')->delete();

        // add user using Eloquent
        $template = new Template;
		$template->template_name = 'template#1';
		
        $template->save();
		
		
		// $templateParams = array(
			// new TemplateParam(array('template_param_name' => 'param#1', 'template_param_type' => 'STRING')),
			// new TemplateParam(array('template_param_name' => 'param#2', 'template_param_type' => 'STRING')),
			// new TemplateParam(array('template_param_name' => 'param#3', 'template_param_type' => 'STRING'))
		// );
		
		for ( $x = 1 ; $x <= 3 ; $x++) {
			$templateParam = new TemplateParam;
			$templateParam->template_param_name = 'param#'.$x;
			$templateParam->template_param_type = 'STRING';
			$template->templateParams()->save($templateParam);
		}
		
		

		// $template->teamplateParams()->saveMany($templateParams);
		
		// $this->command->info('Template - Name >> ' . $template->name);
		// foreach ($template->teamplateParams as $templateParam) {
			// $this->command->info('Template - param >> ' . $templateParam->name . ' - ' . $templateParam->type);
		// }
		// $this->command->info('Template - Last Name >> ' . $template->last_name);
		// $this->command->info('Template - Role Name >> ' . $template->role->role_name);
		// $this->command->info('Template - Department Name >> ' . $user->department->department_name);
    }
}